#region license
# This file is part of Grawlix.
# 
# Grawlix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# 
# Grawlix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with Grawlix.  If not, see
# <http://www.gnu.org/licenses/>.
#endregion

"""Equatable equality testing."""

namespace Grawlix.Meta.Tests.Equality
import Grawlix.Meta
import NUnit.Framework
import System

[TestFixture]
class EquatableEqualityFixture(EqualityAttributeTestCase):

#region aE
	
	[Test]
	def EqualsAE():
		expect aE, \
				_.Equals(a), \
				_.Equals(aE), \
				_.Equals(aO), \
			not	_.Equals(aN), \
			not	_.Equals(aU), \
			not	_.Equals(oN), \
			not	_.Equals(null)
	
	[Test]
	def EqualOperatorAE():
		expect aE, \
				_ == a, \
				_ == aE, \
				_ == aO, \
			not	_ == aN, \
			not	_ == aU, \
			not	_ == oN, \
			not	_ == null
	
	[Test]
	def NotEqualOperatorAE():
		expect aE, \
			not	_ != a, \
			not	_ != aE, \
			not	_ != aO, \
				_ != aN, \
				_ != aU, \
				_ != oN, \
				_ != null
	
#endregion

#region bE
	
	[Test]
	def EqualsBE():
		expect bE, \
				_.Equals(b), \
				_.Equals(bE), \
				_.Equals(bO), \
			not	_.Equals(bN), \
			not	_.Equals(bU), \
			not	_.Equals(oN), \
			not	_.Equals(null)
	
	[Test]
	def EqualOperatorBE():
		expect bE, \
				_ == b, \
				_ == bE, \
				_ == bO, \
			not	_ == bN, \
			not	_ == bU, \
			not	_ == oN, \
			not	_ == null
	
	[Test]
	def NotEqualOperatorBE():
		expect bE, \
			not	_ != b, \
			not	_ != bE, \
			not	_ != bO, \
				_ != bN, \
				_ != bU, \
				_ != oN, \
				_ != null
	
#endregion

#region wE
	
	[Test]
	def EqualsWE():
		expect wE, \
				_.Equals(w), \
				_.Equals(wE), \
				_.Equals(wO), \
			not	_.Equals(oN)
		# See BOO-1061
		expect NullReferenceException:
			expect wE, not _.Equals(wU)
	
	[Test]
	def EqualOperatorWE():
		expect wE, \
				_ == w, \
				_ == wE, \
				_ == wO, \
			not	_ == wU, \
			not	_ == oN
	
	[Test]
	def NotEqualOperatorWE():
		expect wE, \
			not	_ != w, \
			not	_ != wE, \
			not	_ != wO, \
				_ != wU, \
				_ != oN
	
#endregion

#region xE
	
	[Test]
	def EqualsXE():
		expect xE, \
				_.Equals(x), \
				_.Equals(xE), \
				_.Equals(xO), \
			not	_.Equals(oN)
		# See BOO-1061
		expect NullReferenceException:
			expect xE, not _.Equals(xU)
	
	[Test]
	def EqualOperatorXE():
		expect xE, \
				_ == x, \
				_ == xE, \
				_ == xO, \
			not	_ == xU, \
			not	_ == oN
	
	[Test]
	def NotEqualOperatorXE():
		expect xE, \
			not	_ != x, \
			not	_ != xE, \
			not	_ != xO, \
				_ != xU, \
				_ != oN
	
#endregion

